﻿using AutoMapper;
using JXC.Application.Dtos;
using JXC.Core.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace JXC.WebAPI.Profiles
{
    public class CaigouOrderProfile : Profile
    {
        public CaigouOrderProfile()
        {
            CreateMap<CaigouOrder, CaigouOrderDto>()
            .ForMember(dest => dest.SupplierName, opt => { opt.MapFrom(src => src.Supplier.SupplierName); })
            .ForMember(dest => dest.BuyerName, opt => { opt.MapFrom(src => src.UserInfos.UserName); })
            .ForMember(dest => dest.OperatorName, opt => { opt.MapFrom(src => src.UserInfos.UserName); })
            .ForMember(dest => dest.ExaminerName, opt => { opt.MapFrom(src => src.UserInfos.UserName); });
            CreateMap<CaigouOrderDto, CaigouOrder>();
        }
    }
}
